package com.hm.hall.commons.controller;

import com.alibaba.fastjson.JSONObject;
import com.hm.hall.commons.dao.BattleRoomMapper;
import com.hm.hall.commons.domain.BattleRoomExample;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class BattleRoomController {
    @Resource
    private BattleRoomMapper battleRoomMapper;

    @ApiOperation(value = "helloWorld", notes = "")
    @RequestMapping(value = "/battle_index", method = RequestMethod.GET)
    public String index() {
        BattleRoomExample example = new BattleRoomExample();
        example.or().andAnteEqualTo(1);
        example.setOrderByClause("room_id desc limit 0,10");
        return JSONObject.toJSONString(battleRoomMapper.selectByExample(example));
    }
}
